package com.lanyou.cook.entitylistener.domain;

import javax.persistence.PrePersist;
import javax.persistence.PreRemove;
import javax.persistence.PreUpdate;

import com.lanyou.cook.datadictionary.UserLogOpt;
import com.lanyou.cook.entity.domain.Field;
import com.lanyou.cook.service.UserLogService;
import com.lanyou.esb.entity.ExceptionErrorCodeSetting;

public class ExceptionErrorCodeForLog {

	@PrePersist
	public void prePersist(ExceptionErrorCodeSetting target) {
		String content = String.format("新增异常错误码“%s”", target.getErrorCode());
		UserLogService.getInstance().save(UserLogOpt.MaintenanceBaseService, null, content);
	}
	
	@PreUpdate
	public void preUpdate(ExceptionErrorCodeSetting target) {
		String content = String.format("修改异常错误码“%s”", target.getErrorCode());
		UserLogService.getInstance().save(UserLogOpt.MaintenanceBaseService, null, content);
	}
	
	@PreRemove
	public void preRemove(ExceptionErrorCodeSetting target) {
		String content = String.format("删除异常错误码“%s”", target.getErrorCode());
		UserLogService.getInstance().save(UserLogOpt.MaintenanceBaseService, null, content);
	}
}
